package top.cluski.feieprint.domain;

import lombok.Data;

@Data
public class RespVO<T> {
    String code;
    String msg;
    T data;

    public static <T> RespVO<T> success() {
        RespVO<T> resp = new RespVO<>();
        resp.setCode("200");
        resp.setMsg("成功");
        return resp;
    }

    public static <T> RespVO<T> success(T data) {
        RespVO<T> resp = new RespVO<>();
        resp.setCode("200");
        resp.setMsg("成功");
        resp.setData(data);
        return resp;
    }

    public static <T> RespVO<T> fail() {
        RespVO<T> resp = new RespVO<>();
        resp.setCode("500");
        resp.setMsg("内部错误");
        return resp;
    }

    public static <T> RespVO<T> fail(String code, String msg) {
        RespVO<T> resp = new RespVO<>();
        resp.setCode(code);
        resp.setMsg(msg);
        return resp;
    }
}
